<?php
header('content-type:text/html;charset=utf-8');
$mysqli = new Mysqli("localhost","root","root","db_mbl");
if($mysqli->connect_errno){
    die();
}
$sql = "select * from t_brandsgroups";
$res = $mysqli->query($sql);
if ($res->num_rows > 0){
    //查询到数据
    for($i = 0; $i < $res->num_rows;$i++){
        $tabData[] = $res->fetch_assoc();
    }
    $data["list"] = $tabData;
    $data["code"] = 1;
}else{
    //没有数据
    $data["code"] = 0;
}
print_r(json_encode($data));
?>